﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityModel
{
    public class Demo
    {
        /// <summary>
        /// 商品分类表
        /// </summary>
        public class Category
        {
            /// <summary>
            /// 分类ID（自增主键）
            /// </summary>
            [Required]//必填//
            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增//
            [Key]//主键//
            public int id { get; set; }

            /// <summary>
            /// 分类名称（如：手机号）
            /// </summary>
            [StringLength(32)]
            [Required]
            public string? name { get; set; }

            /// <summary>
            /// 父分类ID（顶级分类为0)
            /// </summary>
            public string? parent_id { get; set; }

            /// <summary>
            /// 是否为节点（0否1是）
            /// </summary>
            public int is_parent { get; set; }

            /// <summary>
            /// 排序权重（值越小越靠前）
            /// </summary>
            public int sort { get; set; }

            /// <summary>
            /// 分类层级（1~3级）
            /// </summary>
            public int level { get; set; }
        }

        /// <summary>
        /// 用户主表
        /// </summary>
        public class User
        {
            /// <summary>
            /// ⽤户ID（⾃增主键）
            /// </summary>
            [Required]
            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
            [Key]
            public int User_id { get; set; }

            /// <summary>
            /// ⼿机号（唯⼀）
            /// </summary>
            [StringLength(11)]
            [Required]
            public string? Mobile { get; set; }

            /// <summary>
            /// 加密后的密码
            /// </summary>
            [Required]
            [StringLength(128)]
            public string? Password_hash { get; set; }

            /// <summary>
            /// ⽤户昵称
            /// </summary>
            [StringLength(64)]
            public string? Nickname { get; set; }

            /// <summary>
            /// 最后登录时间
            /// </summary>
            public DateTime MyProperty { get; set; }
        }

        /// <summary>
        /// ⽤户信息表
        /// </summary>
        public class User_profile : User
        {
            /// <summary>
            /// ⽤户ID（与user表⼀对⼀）
            /// </summary>
            [Required]
            [Key]
            [ForeignKey("User_id")]
            public User? User { get; set; }

            /// <summary>
            /// 真实姓名（脱敏显示）
            /// </summary>
            [StringLength(32)]
            public string? Real_name { get; set; }

            /// <summary>
            /// 性别（0未知/1男/2⼥）
            /// </summary>
            public int gender { get; set; } = 0;//默认为0 未知

            /// <summary>
            /// 出⽣⽇期
            /// </summary>
            public DateTime Birthday { get; set; }

            /// <summary>
            /// 身份证号（加密存储）
            /// </summary>
            [StringLength(32)]
            public string? Id_card { get; set; }

            /// <summary>
            /// 头像OSS地址
            /// </summary>
            [StringLength(512)]
            public string? Avatar_url { get; set; }

            /// <summary>
            /// 职业
            /// </summary>
            [StringLength(64)]
            public string? Occupation { get; set; }

            /// <summary>
            /// 婚姻状况（0未填/1未婚/2已婚）
            /// </summary>
            public int Marital_status { get; set; }

            /// <summary>
            /// 信息创建时间
            /// </summary>
            [Required]
            public DateTime Create_time { get; set; }

            /// <summary>
            /// 最后修改时间
            /// </summary>
            [Required]
            public DateTime Update_time { get; set; }
        }

        /// <summary>
        /// 仓库表
        /// </summary>
        public class Warehouse
        {
            /// <summary>
            /// 仓库编号
            /// </summary>
            [Required]
            [Key]
            public int Warehouse_id { get; set; }
            /// <summary>
            /// 仓库地址
            /// </summary>
            [Required]
            [StringLength(100)]
            public string location { get; set; }
            /// <summary>
            /// 最大仓库容量
            /// </summary>
            [Required]
            public int capacity { get; set; }
        }


        /// <summary>
        /// 物流跟踪表
        /// </summary>
        public class Logistucs
        {
            /// <summary>
            /// 物流单号
            /// </summary>
            [Required]
            [StringLength(32)]
            public string? tracking_no { get; set; }
            /// <summary>
            /// 订单号
            /// </summary>
            [Key]
            [Required]
            [StringLength(32)]
            public string? order_id { get; set; }
            /// <summary>
            /// 当前位置
            /// </summary>
            [StringLength(100)]
            [Required]
            public string? current_location { get; set; }
            /// <summary>
            /// 状态更新时间
            /// </summary>
            [Required]
            public DateTime update_time { get; set; }
        }


        /// <summary>
        /// 优惠卷表
        /// </summary>
        public class Coupon
        {
            /// <summary>
            /// 劵ID（如：JD2025SPRING）
            /// </summary>
            [Key]
            [Required]
            public string? coupon_id { get; set; }
            /// <summary>
            /// 类型（1满减/2折扣）
            /// </summary>
            [Required]
            public int discount_type { get; set; }
            /// <summary>
            /// 最低使用金额
            /// </summary>
            [Required]
            public string? min_amount { get; set; }
            /// <summary>
            /// 领取用户ID
            /// </summary>
            [Required]
            public int user_id { get; set; }
        }
    }
}

